package com.example.springwebfluxdoc.model;

import io.swagger.v3.oas.annotations.media.Schema;

/**
 * 用户模型类
 * 包含用户的基本信息
 */
public class User {

    @Schema(description = "用户ID", example = "1")
    private Long id;

    @Schema(description = "用户姓名", example = "张三", required = true)
    private String name;

    @Schema(description = "用户邮箱", example = "zhangsan@example.com", required = true, format = "email")
    private String email;

    @Schema(description = "用户年龄", example = "25", minimum = "18", maximum = "120")
    private Integer age;

    // 无参构造函数
    public User() {
    }

    // 全参构造函数
    public User(Long id, String name, String email, Integer age) {
        this.id = id;
        this.name = name;
        this.email = email;
        this.age = age;
    }

    // Getter和Setter方法
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    @Override
    public String toString() {
        return "User{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", email='" + email + '\'' +
                ", age=" + age +
                '}';
    }
}